﻿<UserControl x:Class="DiscoveryLogic.Analytics.Modules.DataImport.DataImportEditor"
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    Height="300" Width="450" Loaded="UserControl_Loaded">
    <Grid Margin="5">
        <Grid.RowDefinitions>
            <RowDefinition Height="35"/>
            <RowDefinition Height="*"/>
        </Grid.RowDefinitions>
        <Grid.ColumnDefinitions>
            <ColumnDefinition Width="145"/>
            <ColumnDefinition Width="*"/>
        </Grid.ColumnDefinitions>
        
        <Label 
            Grid.Row="0" Grid.Column="0"
            Margin="5,0,0,0"
            VerticalAlignment="Center"
            HorizontalAlignment="Left">
            Data set name:
        </Label>
        <TextBox 
            Grid.Row="0" Grid.Column="1"
            x:Name="txtDataSetName"
            Margin="5,0,0,0"
            VerticalAlignment="Center"
            HorizontalAlignment="Left"
            Width="250"></TextBox>
        
        <TabControl Grid.Row="1" Grid.Column="0" Grid.ColumnSpan="2">
            <TabItem Header="Using rules">
                <Grid>
                    <Grid.RowDefinitions>
                        <RowDefinition Height="35"/>
                        <RowDefinition Height="35"/>
                        <RowDefinition Height="35"/>
                        <RowDefinition Height="*"/>
                        <RowDefinition Height="35"/>
                    </Grid.RowDefinitions>
                    <Grid.ColumnDefinitions>
                        <ColumnDefinition Width="145"/>
                        <ColumnDefinition Width="*"/>
                    </Grid.ColumnDefinitions>

                    <Label 
            Grid.Row="0" Grid.Column="0"
            Margin="5,0,0,0" 
            VerticalAlignment="Center"
            HorizontalAlignment="Left">
                        Import rule:
                    </Label>
                    <ComboBox 
            Grid.Row="0" Grid.Column="1"
            x:Name="cboImportRules"
            Margin="5,0,0,0"
            VerticalAlignment="Center"
            HorizontalAlignment="Left"
            Width="250"
            SelectionChanged="cboImportRules_SelectionChanged"></ComboBox>

                    <Label 
            Grid.Row="1" Grid.Column="0"
            Margin="5,0,0,0"
            x:Name="lblDataSrcPath"
            VerticalAlignment="Center"
            HorizontalAlignment="Left">
                        Data path:
                    </Label>
                    <StackPanel 
            Orientation="Horizontal" Grid.Row="1" Grid.Column="1"
            Margin="5,0,5,0" VerticalAlignment="Center">
                        <TextBox 
                x:Name="txtDataSrcPath"
                Margin="0,0,0,0"
                VerticalAlignment="Center"
                HorizontalAlignment="Left"
                Width="250"></TextBox>
                        <Button 
                x:Name="btnBrowse" Margin="5,0,5,0"
                VerticalAlignment="Center"
                HorizontalAlignment="Left"
                Width="30" Content=".." Click="btnBrowse_Click" />
                    </StackPanel>

                    <Label 
            Grid.Row="2" Grid.Column="0"
            x:Name="lblRecordPath"
            Margin="5,5,0,0"
            VerticalAlignment="Top"
            HorizontalAlignment="Left">
                        Record path:
                    </Label>
                    <ComboBox 
            Grid.Row="2" Grid.Column="1"
            x:Name="cboRecordPath"
            Margin="5,5,0,0"
            VerticalAlignment="Top"
            HorizontalAlignment="Left"
            Width="250"></ComboBox>
                    <TextBox 
            Grid.Row="3" Grid.Column="1"
            x:Name="txtSql"
            Margin="5,5,0,0" TextWrapping="Wrap"
            AcceptsReturn="True"
            VerticalAlignment="Top"
            HorizontalAlignment="Left"
            Width="250" MinHeight="55"
            Visibility="Hidden"></TextBox>

                    <Label 
            Grid.Row="3" Grid.Column="0"
            Margin="5,5,0,0"
            VerticalAlignment="Top"
            HorizontalAlignment="Left">
                        Available fields:
                    </Label>
                    <ListBox 
            Grid.Row="3" Grid.Column="1"
            Margin="5,5,0,0"
            x:Name="lbSrcFields"
            VerticalAlignment="Top"
            HorizontalAlignment="Left"
            Width="250" Height="65"></ListBox>

                    <StackPanel 
            Grid.Row="5" Grid.Column="0" Grid.ColumnSpan="2"
            Margin="0,0,35,0"
            HorizontalAlignment="Right"
            VerticalAlignment="Center"
            Orientation="Horizontal">
                        <Button x:Name="btnCancel" Content="Cancel" Width="55" Margin="5,0,5,0" VerticalAlignment="Center" Click="btnCancel_Click"></Button>
                        <Button x:Name="btnImport" Content="Import" Width="55" Margin="5,0,5,0" VerticalAlignment="Center" Click="btnImport_Click"></Button>
                    </StackPanel>
                </Grid>
            </TabItem>
            <TabItem Header="Using keys">
                <Grid>
                    <Grid.RowDefinitions>
                        <RowDefinition Height="35"/>
                        <RowDefinition Height="35"/>
                        <RowDefinition Height="*"/>
                        <RowDefinition Height="35"/>
                    </Grid.RowDefinitions>
                    <Grid.ColumnDefinitions>
                        <ColumnDefinition Width="145"/>
                        <ColumnDefinition Width="*"/>
                    </Grid.ColumnDefinitions>
                    
                    <Label
                        Grid.Row="0" Grid.Column="0"
                        Margin="5,0,0,0" VerticalAlignment="Center">
                        Entity type:
                    </Label>
                    <ComboBox
                        Grid.Row="0" Grid.Column="1" x:Name="cboEntityType"
                        Margin="5,0,5,0" VerticalAlignment="Center" SelectionChanged="cboEntityType_SelectionChanged">
                    </ComboBox>
                    
                    <Label
                        Grid.Row="1" Grid.Column="0"
                        Margin="5,0,0,0" VerticalAlignment="Center">
                        Field:
                    </Label>
                    <TextBlock
                        Grid.Row="1" Grid.Column="1" x:Name="txtKeyField"
                        Margin="5,0,5,0" VerticalAlignment="Center"/>
                    
                    <TextBox
                        Grid.Row="2" Grid.Column="0" Grid.ColumnSpan="2"
                        Margin="5" VerticalAlignment="Top" AcceptsReturn="True"
                        Height="100" TextWrapping="Wrap" x:Name="txtKeys"></TextBox>
                    
                    <StackPanel
                        Grid.Row="3" Grid.Column="0" Grid.ColumnSpan="2"
                        Margin="5,0,5,0" VerticalAlignment="Center"
                        HorizontalAlignment="Right" Orientation="Horizontal">
                        <Button x:Name="btnCancel2" Content="Cancel" Width="55" Margin="5,0,5,0" VerticalAlignment="Center" Click="btnCancel_Click"></Button>
                        <Button x:Name="btnImport2" Content="Import" Width="55" Margin="5,0,5,0" VerticalAlignment="Center" Click="btnImport2_Click"></Button>
                    </StackPanel>
                </Grid>
            </TabItem>
        </TabControl>
        
        
    </Grid>
</UserControl>
